home *** CD-ROM | disk | FTP | other *** search
/ PC Play 129 / pc play 129.iso / Demo / man2 / man2.exe / data / scripts / mortar_alien_scripts.lua < prev    next >
Encoding:
Text File  |  2006-08-31  |  6.3 KB  |  168 lines

  1.  
  2. function units_mortar_alien_setup()
  3.     units_setup(4,true,ENET_EFFECT_PS_SETUPSMOKE_MEDIUM,ENET_EFFECT_GEOMETRY_MORTARALIENSHADOW)
  4. end
  5.  
  6. function units_mortar_alien_resetup()
  7.     units_setup(4,true,nil,ENET_EFFECT_GEOMETRY_MORTARALIENSHADOW)
  8. end
  9.  
  10. function units_mortar_alien_select()
  11.     units_select(22,2)
  12. end
  13.  
  14. function units_mortar_alien_unselect()
  15.     units_unselect()
  16. end
  17.  
  18. function units_mortar_alien_selectenemy()
  19.     uniGetExecutor():addSimpleEffect(ENET_EFFECT_SELECTEDGEOMETRY_ENEMY)
  20. end
  21.  
  22. function units_mortar_alien_damaged()
  23.     uniGetExecutor():applyDamage(uniGetLife())
  24. end
  25.  
  26. function units_mortar_alien_highlight()
  27.     uniGetExecutor():addEffectWithRadius(ENET_EFFECT_GEOMETRY_HIGHLIGHT,15)
  28. end
  29.  
  30. function units_mortar_alien_explode()
  31.     units_explode_small3_green()
  32. end
  33.  
  34. function units_mortar_alien_move()
  35.     local unit = uniGetExecutor()
  36.     local sound = unit:play3DSound("mortar_alien_move.wav",1)
  37.     local steps = {}
  38.     local i = 0;
  39.     for i = 0,1 do
  40.         steps[i] = unit:getBone(ENBT_STEPEMITTER,i):addSimpleEffect(ENET_EFFECT_DYNAMICGEOMETRY_LIGHTTANKSTEPSEMITTER)
  41.         steps[i+2] = unit:getBone(ENBT_STEPEMITTER,i):addSimpleEffect(ENET_EFFECT_PS_NEWTRACKSMOKE3)
  42.     end
  43.     waitDeath(unit:addRotationEffect(ENET_EFFECT_ROTATE_UNIT,MATH_PI * 1.0))
  44.     waitDeath(unit:addMoveEffect(ENET_EFFECT_MOVE_LINEAR,100))
  45.     sound:destroy()
  46.     unit:play3DSound("mortar_alien_stop.wav",0):destroy()
  47.     for i = 0,1 do
  48.         if(unit:getScale() < 1.0) then 
  49.             steps[i]:destroy()
  50.         else
  51.             steps[i]:setTransformOwner()
  52.             steps[i]:suspendedDestroy(70)
  53.         end
  54.         steps[i+2]:suspendedDestroy(1.0)
  55.     end
  56. end
  57.  
  58. function units_mortar_alien_fire()
  59.     local unit = uniGetExecutor()
  60.     local gt = unit:getBone(ENBT_GUNTOWER)
  61. --    local sound = gt:play3DSound("mortar_guntower_rotate.wav",1)
  62.     gt:play3DSound("mortar_guntower_rotate.wav",0)
  63.     waitDeath(gt:addRotationEffect(ENET_EFFECT_ROTATE_GUNTOWERTOTARGET,MATH_PI,uniGetTarget()))
  64.     local firespot = gt:getBone(ENBT_FIRE1)
  65.     local shot = firespot:addBulletEffect(ENET_EFFECT_BULLET_SPAWNEDPLAZMABALL)
  66.     local shot2 = shot:addSimpleEffect(ENET_EFFECT_PS_MORTARSPARKLES)
  67.     shot:executeCommand(ENC_FIRE1)
  68.     local gun = gt:getBone(ENBT_GUN)
  69.     waitDeath(gun:addRotationEffect(ENET_EFFECT_ROTATE_GUNTOTARGET_GRAVITYPARABOLA,MATH_PI / 3.0,uniGetTarget()))
  70. --    sound:stopSound()
  71.     pause(1.5)
  72.     gt:play3DSound("mortar_guntower_rotate.wav",0)
  73.     gun:addRotationEffect(ENET_EFFECT_ROTATE_GUNTOWERDEFAULT,MATH_PI / 3.0)
  74.     gt:addRotationEffect(ENET_EFFECT_ROTATE_GUNTOWERDEFAULT,MATH_PI)
  75.     unit:addFireArrow()
  76. end
  77.  
  78. registerCommand(ENSCRIPTSET_MORTAR_ALIEN,ENC_MOVE,"units_mortar_alien_move")
  79. registerCommand(ENSCRIPTSET_MORTAR_ALIEN,ENC_FIRE1,"units_mortar_alien_fire")
  80. registerCommand(ENSCRIPTSET_MORTAR_ALIEN,ENC_FIRE2,"units_mortar_alien_fire")
  81. registerCommand(ENSCRIPTSET_MORTAR_ALIEN,ENC_SELECT,"units_mortar_alien_select")
  82. registerCommand(ENSCRIPTSET_MORTAR_ALIEN,ENC_SELECTENEMY,"units_mortar_alien_selectenemy")
  83. registerCommand(ENSCRIPTSET_MORTAR_ALIEN,ENC_UNSELECT,"units_mortar_alien_unselect")
  84. registerCommand(ENSCRIPTSET_MORTAR_ALIEN,ENC_SETUP,"units_mortar_alien_setup")
  85. registerCommand(ENSCRIPTSET_MORTAR_ALIEN,ENC_RESETUP,"units_mortar_alien_resetup")
  86. registerCommand(ENSCRIPTSET_MORTAR_ALIEN,ENC_DAMAGED,"units_mortar_alien_damaged")
  87. registerCommand(ENSCRIPTSET_MORTAR_ALIEN,ENC_EXPLODE,"units_mortar_alien_explode")
  88. registerCommand(ENSCRIPTSET_MORTAR_ALIEN,ENC_HIGHLIGHT,"units_mortar_alien_highlight")
  89. registerCommand(ENSCRIPTSET_MORTAR_ALIEN,ENC_INSIDE,"units_inside")
  90.  
  91. -- make description of unit
  92. desc = getEffectDescriptionP(ENET_UNIT_MORTAR_ALIEN)
  93. desc.ClassID = ENCLASS_MESHINSTANCE
  94. desc.EffectClassType = ENECT_GEOMETRY
  95. desc.FileName = "mortar_alien.rmd"
  96. desc.ScriptSet = ENSCRIPTSET_MORTAR_ALIEN
  97. desc.MoveType = ENMOVE_GROUNDORIENTED
  98. desc.RenderType = ENRENDERTYPE_GEOMETRY
  99. desc.Material = ENMAT_RIGIDSKINNEDMESH
  100. desc.MaterialColors = units_materialcolors_human
  101.  
  102. -- shadow
  103. desc = getEffectDescriptionP(ENET_EFFECT_GEOMETRY_MORTARALIENSHADOW)
  104. desc.ClassID = ENCLASS_MESHINSTANCE
  105. desc.EffectClassType = ENECT_GEOMETRY
  106. desc.FileName = "mortar_alien_shadow.rmd"
  107. desc.RenderType = ENRENDERTYPE_SHADOW
  108. desc.Material = ENMAT_SHADOW
  109. desc.MaterialColors = units_materialcolors_shadow
  110.  
  111. -- register new unit to logic
  112. unitDesc = logic_getUnitDescP(17)
  113. unitDesc.group = 0
  114. unitDesc.order = 2
  115. unitDesc.unit_res_id = ENET_UNIT_MORTAR_ALIEN
  116. unitDesc.unit_icon_id = "Mortar_a_small_normal.dds"
  117. unitDesc.active_id = "Mortar_a_small_active.dds"
  118. unitDesc.pressed_id = "Mortar_a_small_pressed.dds"
  119. unitDesc.big_icon_id = "Mortar_a_big_normal.dds"
  120. unitDesc.small_icon_id = "Mortar_l_stats.dds"
  121. unitDesc.HP = 4
  122. unitDesc.MP = 10
  123. unitDesc.WR = 2
  124. unitDesc.min_WR = 1
  125. unitDesc.WD = 2
  126. unitDesc.WR2 = 0
  127. unitDesc.min_WR2 = 0
  128. unitDesc.WD2 = 0
  129. unitDesc.ability = 0
  130. unitDesc.transport = 0
  131. unitDesc.value = 2
  132. unitDesc.race = 1
  133. unitDesc.fire_pause = 1.0
  134. unitDesc.move_pause = 0.7
  135. unitDesc.unit_info_scale = 0.06
  136. unitDesc.scn_name = "MORTARA"
  137.  
  138. ------------------------------------------------------------------------------------------------------
  139. ------------------------ effects related to unit------------------------------------------------------
  140. ------------------------------------------------------------------------------------------------------
  141.  
  142. function bullets_plazmaballalien_fire()
  143.     local bullet = uniGetExecutor()
  144.     local light = bullet:addSimpleEffect(ENET_EFFECT_LIGHT_SPAWNEDPLAZMABALLFLY)
  145. --    local sound = bullet:play3DSound("mortar_alien_cannon_fire.wav",1)
  146.     bullet:play3DSound("mortar_alien_cannon_fire.wav",0)
  147.     local track = bullet:addSimpleEffect(ENET_EFFECT_PS_PLAZMABALLSPAWNING)
  148.     pause(1.35)
  149.     bullet:setTransformOwner()
  150.     waitDeath(bullet:addMoveEffect(ENET_EFFECT_MOVE_GRAVITYPARABOLA,150,uniGetTarget()))
  151. --    sound:destroy()
  152.     light:destroy()
  153.     track:suspendedDestroy(1.0)
  154.     bullet:play3DSound("mortar_alien_cannon_explode.wav",0):destroy()
  155.     local exp1 = bullet:addSimpleEffect(ENET_EFFECT_PS_SPAWNEDPLAZMABALLHIT)
  156.     pause(0.1)
  157.     bullet:addSimpleEffect(ENET_EFFECT_LIGHT_SPAWNEDPLAZMABALLHIT):delayedDestroy(1.0)
  158.     local exp = bullet:addSimpleEffect(ENET_EFFECT_PS_SPHEREOFLIGHTNINGS)
  159.     pause(0.3)
  160.     exp:suspendedDestroy(1.0)
  161.     exp1:suspendedDestroy(1.0)
  162.     uniGetTarget():executeCommand(ENC_DAMAGED)
  163.     pause(1.0)
  164.     bullet:destroy()
  165. end
  166.  
  167. registerCommand(ENSCRIPTSET_BULLET_SPAWNEDPLAZMABALL,ENC_FIRE1,"bullets_plazmaballalien_fire")
  168.